package com.vikutorika.service;

import cn.hutool.core.util.StrUtil;
import com.vikutorika.dao.imp.FriendRelationDAOImp;
import com.vikutorika.entity.FriendRelation;
import com.vikutorika.vo.FriendVo;
import com.vikutorika.vo.ResultVo;

import java.util.List;

public class FriendService {
	public static ResultVo query(FriendVo friendVo){
		if (StrUtil.isBlank(friendVo.getUid()) &&
				StrUtil.isBlank(friendVo.getName()) &&
				StrUtil.isBlank(friendVo.getGender())){
			FriendRelationDAOImp friendRelationDAO = new FriendRelationDAOImp();
			List<FriendRelation> list = friendRelationDAO.getAll();
			return ResultVo.success("Query successfully", list);
		}else {
			FriendRelationDAOImp friendRelationDAO = new FriendRelationDAOImp();
			List<FriendRelation> list = friendRelationDAO.query(friendVo);
			return ResultVo.success();
		}
	}
}
